/*
 * @Author: IBOSS 2776641037@qq.com
 * @Date: 2025-08-04 11:22:55
 * @LastEditors: IBOSS 2776641037@qq.com
 * @LastEditTime: 2025-08-11 13:52:10
 * @FilePath: \nuxt-js\nuxt.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export default {
  // Global page headers (https://go.nuxtjs.dev/config-head)
  head: {
    title: 'new-nuxtJs',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#2F6BEE' },

  // Global CSS (https://go.nuxtjs.dev/config-css)
  // 全局css
  css: [
    '@/assets/css/global.scss'
  ],

  // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  plugins: [
    '~/plugins/axios.js'
  ],

  // Auto import components (https://go.nuxtjs.dev/config-components)
  components: true,

  // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    // '@nuxtjs/eslint-module'

  ],

  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios'
  ],

  // Axios module configuration (https://go.nuxtjs.dev/config-axios)
  axios: {
    // 配置跨域
    proxy: true, // 表示开启代理
    prefix: '/adminapi', // 表示给请求url加个前缀 /adminapi
    credentials: true, // 表示跨域请求时是否需要使用凭证
    baseURL: process.env.NODE_ENV === 'production' 
      ? 'https://queen.njzshm.com' 
      : 'http://localhost:3000'
  },
  proxy: {
    '/adminapi': {
      target: 'https://queen.njzshm.com', // 目标接口域名
      changeOrigin: true, // 表示是否跨域
      pathRewrite: {
        '^/adminapi': '/adminapi' // 保持 /adminapi 前缀
      }
    }
  },

  // Build Configuration (https://go.nuxtjs.dev/config-build)
  build: {
    vendor: ['axios'], // 为防止重复打包
    publicPath: 'https://wen.njzshm.com/client'
  }
}
